/**
 * 诗词相关接口类型定义
 */

import { BaseApiResponse } from "./interface";

// 诗词基本信息
export interface PoetryInfo {
  id: string;
  title: string;         // 诗词标题
  author: string;        // 作者
  dynasty?: string;      // 朝代
  content: string;       // 诗词内容
  translation?: string;  // 翻译
  annotation?: string;   // 注释
  appreciation?: string; // 赏析
  category?: string;     // 分类（如：诗、词、曲等）
  theme?: string;        // 主题（如：咏物、抒情、写景等）
  style?: string;        // 风格（如：豪放、婉约等）
  difficulty: number;    // 难度等级 1-5
  status: number;        // 状态：0-禁用，1-启用
  tags?: string[];       // 标签
  viewCount?: number;    // 查看次数
  favoriteCount?: number; // 收藏次数
  createTime: Date;
  updateTime?: Date;
}

// 诗词详情（包含额外信息）
export interface PoetryDetailInfo extends PoetryInfo {
  relatedPoetries?: PoetryInfo[]; // 相关诗词
  authorInfo?: {
    name: string;
    biography?: string;
    representative_works?: string[];
  };
  background?: string;    // 创作背景
  metrics?: {
    rhythm?: string;      // 格律
    rhyme?: string;       // 韵律
  };
}

// 诗词列表响应
export interface PoetryListResponse {
  poetries: PoetryInfo[];
  total: number;
  page: number;
  size: number;
}

export interface PoetryListApiResponse extends BaseApiResponse<PoetryListResponse> {}

// 诗词详情响应
export interface PoetryDetailApiResponse extends BaseApiResponse<PoetryDetailInfo> {}

// 诗词搜索结果
export interface PoetrySearchResult extends PoetryInfo {
  score?: number;        // 搜索匹配度
  highlightContent?: string; // 高亮内容
}

// 诗词搜索响应
export interface PoetrySearchResponse {
  results: PoetrySearchResult[];
  total: number;
  page: number;
  size: number;
  searchTime: number;    // 搜索耗时（毫秒）
  suggestions?: string[]; // 搜索建议
}

export interface PoetrySearchApiResponse extends BaseApiResponse<PoetrySearchResponse> {}

// 诗词分类统计
export interface PoetryCategoryStats {
  category: string;
  count: number;
  percentage: number;
}

// 诗词统计响应
export interface PoetryStatsResponse {
  totalCount: number;
  categoryStats: PoetryCategoryStats[];
  dynastyStats: PoetryCategoryStats[];
  authorStats: PoetryCategoryStats[];
  popularPoetries: PoetryInfo[]; // 热门诗词
}

export interface PoetryStatsApiResponse extends BaseApiResponse<PoetryStatsResponse> {}

// 随机诗词响应
export interface RandomPoetryApiResponse extends BaseApiResponse<PoetryInfo> {}
